package com.hnkywl.sts.action.cwgl.kmys;

import com.hnkywl.sts.entity.organ.Gsjg;
import com.hnkywl.sts.service.organ.GsjgService;
import net.ruixin.web.struts2.SimpleActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created with IntelliJ IDEA.
 * User: ccr
 * Date: 13-5-16
 * Time: 下午12:27
 * To change this template use File | Settings | File Templates.
 */
@Namespace("/cwgl/kmys/gsjgkmdmys")
public class GsjgkmdmysAction extends SimpleActionSupport {
    private GsjgService gsjgService;
    //公司机构
    private Gsjg gsjg;
    //父机构Id
    private Long sjjgId;
    //科目代码
    private String kmdm;
    //公司机构名称
    private String mc;
    //分页组件 起始位置
    private int page;
    //分页组件 页面大小
    private int rows;


    @Action("gsjgkmdmysList")
    public void gsjgKmdmys(){
        renderJson(gsjgService.findKmdm(sjjgId,mc,null,page,rows));
    }

    @Action("save")
    public void saveKmdm(){
        try{
            gsjgService.saveKmdm(gsjg);
            renderJson("{\"statusCode\":200}");
        }catch (Exception  e) {
            e.printStackTrace();
            renderJson("{\"statusCode\":300,\"message\":\""+e.getMessage()+"\"}");
        }
    }


    public Gsjg getGsjg() {
        return gsjg;
    }

    public void setGsjg(Gsjg gsjg) {
        this.gsjg = gsjg;
    }

    public Long getSjjgId() {
        return sjjgId;
    }

    public void setSjjgId(Long sjjgId) {
        this.sjjgId = sjjgId;
    }

    public String getKmdm() {
        return kmdm;
    }

    public void setKmdm(String kmdm) {
        this.kmdm = kmdm;
    }

    public String getMc() {
        return mc;
    }

    public void setMc(String mc) {
        this.mc = mc;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }

    @Autowired
    public void setGsjgService(GsjgService gsjgService) {
        this.gsjgService = gsjgService;
    }
}
